﻿<%@ Page Title="Edit Delivery" Language="C#" MasterPageFile="~/Pages/user/userMaster.Master" AutoEventWireup="true" CodeBehind="EditDelivery.aspx.cs" Inherits="WarehouseWebAPP.Pages.user.Edit_Entities.EditDelivery" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">

        .style33
        {
            color: #6D6D6D;
            text-align: left;
        }
        .style34
        {
            color: #000000;
        }
        .style37
        {
        }
        .style38
        {
            width: 135px;
        }
        .style39
        {
            width: 129px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table class="style1" style="width: 109%; margin-right: 0px;">
    <tr>
        <td align="center" colspan="4">
                <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                    <ContentTemplate>
                        <asp:Label ID="SentLabel" runat="server" BackColor="#FFFFCC" 
                    ForeColor="#607894" Text="Mail Sent" Visible="False"></asp:Label>
                    </ContentTemplate>
                </asp:UpdatePanel>
        </td>
    </tr>
    <tr>
        <td align="center" colspan="4">
                <asp:UpdateProgress ID="UpdateProgress2" runat="server" DisplayAfter="1000">
                    <ProgressTemplate>
                        <img alt="" src="../../images/update.gif" 
    style="width: 31px; height: 31px" />
                    </ProgressTemplate>
                </asp:UpdateProgress>
        </td>
    </tr>
    <tr>
        <td class="style38">
            <asp:Label ID="Label3" runat="server" Text="Component"></asp:Label>
        </td>
        <td class="style39">
            <cc1:ComboBox ID="ComponentComboBox" runat="server" AppendDataBoundItems="True" 
                AutoCompleteMode="Append" DataSourceID="ComponentObjectDataSource" 
                DataTextField="component_serial_num" DataValueField="component_num" 
                DropDownStyle="DropDownList" MaxLength="0" 
                ondatabound="ComponentComboBox_DataBound" style="display: inline;">
            </cc1:ComboBox>
        </td>
        <td class="style37">
            <asp:Label ID="Label4" runat="server" Text="User"></asp:Label>
        </td>
        <td>
            <cc1:ComboBox ID="UseComboBox2" runat="server" AppendDataBoundItems="True" 
                AutoCompleteMode="Append" DataSourceID="UserObjectDataSourceMail" 
                DataTextField="user_name" DataValueField="user_num" 
                DropDownStyle="DropDownList" MaxLength="0" ondatabound="UseComboBox2_DataBound" 
                style="display: inline;">
            </cc1:ComboBox>
        </td>
    </tr>
    <tr>
        <td class="style38">
            <asp:Label ID="Label5" runat="server" Text="Customer"></asp:Label>
        </td>
        <td class="style39">
            <cc1:ComboBox ID="CustomerCComboBox" runat="server" AppendDataBoundItems="True" 
                AutoCompleteMode="Append" DataSourceID="CustomerObjectDataSource" 
                DataTextField="customer_name" DataValueField="customer_num" 
                DropDownStyle="DropDownList" MaxLength="0" 
                ondatabound="CustomerCComboBox_DataBound" style="display: inline;">
            </cc1:ComboBox>
        </td>
        <td class="style37" colspan="2">
        </td>
    </tr>
        <tr>
            <td class="style38">
            <asp:Label ID="Label6" runat="server" Text="From"></asp:Label>
            </td>
            <td class="style39">
                <asp:TextBox ID="FromTextBox" runat="server"></asp:TextBox>
                <cc1:MaskedEditExtender ID="FromTextBox_MaskedEditExtender" runat="server" 
                    TargetControlID="FromTextBox" Mask="99/99/9999" MaskType="Date" 
                    UserDateFormat="DayMonthYear" >
                </cc1:MaskedEditExtender>
                <cc1:CalendarExtender ID="FromTextBox_CalendarExtender" runat="server" 
                    Format="dd/MM/yyyy" TargetControlID="FromTextBox">
                </cc1:CalendarExtender>
            </td>
            <td class="style37">
            <asp:Label ID="Label7" runat="server" Text="To"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="ToTextBox" runat="server"></asp:TextBox>
                <cc1:MaskedEditExtender ID="ToTextBox_MaskedEditExtender" runat="server" 
                    TargetControlID="ToTextBox" Mask="99/99/9999" MaskType="Date" 
                    UserDateFormat="DayMonthYear">
                </cc1:MaskedEditExtender>
                <cc1:CalendarExtender ID="ToTextBox_CalendarExtender" runat="server" 
                    Format="dd/MM/yyyy" TargetControlID="ToTextBox">
                </cc1:CalendarExtender>
            </td>
        </tr>
        <tr>
            <td bgcolor="#E3E6EA" colspan="3">
                &nbsp;</td>
            <td bgcolor="#E3E6EA">
            <asp:Button ID="Button1" runat="server" BackColor="#FFFBFF" 
 BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px"  
 Font-Names="Verdana" Font-Size="Small" ForeColor="#284775" Text="GO" Width="76px" 
                onclick="Button1_Click"/>
            </td>
        </tr>
    <tr>
        <td colspan="4">
                    &nbsp;</td>
    </tr>
    <tr>
        <td colspan="4">
            <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <asp:DetailsView ID="DeliveredDetailsView" runat="server" AllowPaging="True" 
                        AutoGenerateRows="False" CellPadding="4" DataKeyNames="delivered_num" 
                        DataSourceID="DeliveredObjectDataSource" ForeColor="#333333" GridLines="None" 
                        Height="50px" ondatabound="DeliveredDetailsView_DataBound" 
                        onitemcommand="DeliveredDetailsView_ItemCommand" Width="362px">
                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                        <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />
                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                        <Fields>
                            <asp:BoundField DataField="delivered_num" HeaderText="delivered_num" 
                                ReadOnly="True" SortExpression="delivered_num" Visible="False" />
                            <asp:TemplateField HeaderText="Component Serial No." 
                                SortExpression="delivered_component">
                                <EditItemTemplate>
                                    <cc1:ComboBox ID="ComboBox3" runat="server" AppendDataBoundItems="True" 
                                        AutoCompleteMode="Append" DataSourceID="ComponentObjectDataSource" 
                                        DataTextField="component_serial_num" DataValueField="component_num" 
                                        DropDownStyle="DropDownList" MaxLength="0" 
                                        SelectedValue='<%# Bind("delivered_component") %>' style="display: inline;">
                                    </cc1:ComboBox>
                                    <asp:ObjectDataSource ID="ComponentObjectDataSource" runat="server" 
                                        SelectMethod="ComponentGetData" 
                                        TypeName="WarehouseWebAPP.code.BLL.ComponentBLL"></asp:ObjectDataSource>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:TextBox ID="TextBox1" runat="server" 
                                        Text='<%# Bind("delivered_component") %>'></asp:TextBox>
                                </InsertItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="ComponentLabel" runat="server" 
                                        Text='<%# Bind("delivered_component") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="User" SortExpression="delivered_user">
                                <EditItemTemplate>
                                    <cc1:ComboBox ID="ComboBox1" runat="server" AppendDataBoundItems="True" 
                                        AutoCompleteMode="Append" DataSourceID="UserObjectDataSource1" 
                                        DataTextField="user_name" DataValueField="user_num" 
                                        DropDownStyle="DropDownList" MaxLength="0" 
                                        SelectedValue='<%# Bind("delivered_user") %>' style="display: inline;">
                                    </cc1:ComboBox>
                                    <asp:ObjectDataSource ID="UserObjectDataSource1" runat="server" 
                                        SelectMethod="userGet" TypeName="WarehouseWebAPP.code.BLL.UserBLL">
                                    </asp:ObjectDataSource>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("delivered_user") %>'></asp:TextBox>
                                </InsertItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="UserLabel" runat="server" Text='<%# Bind("delivered_user") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Customer" SortExpression="delivered_customer">
                                <EditItemTemplate>
                                    <cc1:ComboBox ID="ComboBox2" runat="server" AppendDataBoundItems="True" 
                                        AutoCompleteMode="Append" DataSourceID="CustomerObjectDataSource1" 
                                        DataTextField="customer_name" DataValueField="customer_num" 
                                        DropDownStyle="DropDownList" MaxLength="0" 
                                        SelectedValue='<%# Bind("delivered_customer") %>' style="display: inline;">
                                    </cc1:ComboBox>
                                    <asp:ObjectDataSource ID="CustomerObjectDataSource1" runat="server" 
                                        SelectMethod="CustomerGet" TypeName="WarehouseWebAPP.code.BLL.CustomerBLL">
                                    </asp:ObjectDataSource>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:TextBox ID="TextBox3" runat="server" 
                                        Text='<%# Bind("delivered_customer") %>'></asp:TextBox>
                                </InsertItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="CustomerLabel" runat="server" 
                                        Text='<%# Bind("delivered_customer") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Delivery Date" SortExpression="delivered_date">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("delivered_date") %>'></asp:TextBox>
                                    <cc1:MaskedEditExtender ID="TextBox5_MaskedEditExtender" runat="server" 
                                        Mask="99/99/9999" MaskType="Date" TargetControlID="TextBox5" 
                                        UserDateFormat="DayMonthYear">
                                    </cc1:MaskedEditExtender>
                                    <cc1:CalendarExtender ID="TextBox5_CalendarExtender" runat="server" 
                                        Format="dd/MM/yyyy" TargetControlID="TextBox5">
                                    </cc1:CalendarExtender>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("delivered_date") %>'></asp:TextBox>
                                    <cc1:MaskedEditExtender ID="TextBox4_MaskedEditExtender" runat="server" 
                                        Mask="99/99/9999" MaskType="Date" TargetControlID="TextBox4" 
                                        UserDateFormat="DayMonthYear">
                                    </cc1:MaskedEditExtender>
                                </InsertItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("delivered_date") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="delivered_quantity" HeaderText="Delivered Quantity" 
                                SortExpression="delivered_quantity" />
                            <asp:CommandField ShowDeleteButton="True" />
                            <asp:ButtonField CommandName="MailDelivery" Text="Mail Delivery" />
                        </Fields>
                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <EditRowStyle BackColor="#999999" />
                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                    </asp:DetailsView>
                    <br />
                    <asp:Panel ID="MailPanel1" runat="server" BorderStyle="Groove" 
                        CssClass="style33" Height="349px" Visible="False" Width="641px">
                        <br />
                        <asp:RadioButton ID="CustomerRadioButton" runat="server" Checked="True" 
                            ForeColor="Black" GroupName="Group1" 
                            Text="Send This Delivery Details to it's Customer" />
                        <br />
                        <asp:RadioButton ID="UserRadioButton" runat="server" ForeColor="Black" 
                            GroupName="Group1" Text="Send This Delivery Details to the following User" />
                        &nbsp;<cc1:ComboBox ID="UserComboBox" runat="server" AppendDataBoundItems="True" 
                            AutoCompleteMode="Append" DataSourceID="UserObjectDataSourceMail" 
                            DataTextField="user_name" DataValueField="user_num" 
                            DropDownStyle="DropDownList" style="display: inline;">
                        </cc1:ComboBox>
                        <br />
                        <br />
                        <span class="style34">Add Notes:</span><br />
                        <asp:TextBox ID="NotesTextBox" runat="server" Height="146px" 
                            TextMode="MultiLine" Width="629px" ForeColor="Black"></asp:TextBox>
                        <br />
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <asp:Button ID="SendButton" runat="server" BackColor="#FFFBFF" 
                            BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" 
                            Font-Names="Verdana" Font-Size="Small" ForeColor="#284775" Height="25px" 
                            onclick="SendButton_Click" style="text-align: center" Text="Send Mail" 
                            Width="99px" />
                        <br />
                    </asp:Panel>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
                </Triggers>
            </asp:UpdatePanel>
        </td>
    </tr>
    <tr>
        <td colspan="4">
            <asp:ObjectDataSource ID="CustomerObjectDataSource" runat="server" 
                    SelectMethod="CustomerGet" TypeName="WarehouseWebAPP.code.BLL.CustomerBLL">
            </asp:ObjectDataSource>
            <asp:ObjectDataSource ID="UserObjectDataSource" runat="server" 
                    SelectMethod="userGet" TypeName="WarehouseWebAPP.code.BLL.UserBLL">
            </asp:ObjectDataSource>
                <asp:ObjectDataSource ID="UserObjectDataSourceMail" runat="server" 
                    SelectMethod="userGet" TypeName="WarehouseWebAPP.code.BLL.UserBLL" 
                >
                </asp:ObjectDataSource>
            <asp:ObjectDataSource ID="ComponentObjectDataSource" runat="server" 
                    SelectMethod="ComponentGetData" 
                    TypeName="WarehouseWebAPP.code.BLL.ComponentBLL"></asp:ObjectDataSource>
            <asp:ObjectDataSource ID="DeliveredObjectDataSource" runat="server" 
                    SelectMethod="DeliveredSearch" 
                    TypeName="WarehouseWebAPP.code.BLL.DeliveredBLL" 
                DeleteMethod="DeliveredDelete" OldValuesParameterFormatString="original_{0}">
                <SelectParameters>
                    <asp:ControlParameter ControlID="ComponentComboBox" DefaultValue="%" 
                            Name="delivered_component" PropertyName="SelectedValue" 
                        Type="String" />
                    <asp:ControlParameter ControlID="UseComboBox2" DefaultValue="%" 
                            Name="delivered_user" PropertyName="SelectedValue" Type="String" />
                    <asp:ControlParameter ControlID="CustomerCComboBox" DefaultValue="%" 
                            Name="delivered_customer" PropertyName="SelectedValue" Type="String" />
                    <asp:ControlParameter ControlID="FromTextBox" DefaultValue="1/1/1753"
                            Name="delivered_date_from" PropertyName="Text" Type="DateTime" />
                    <asp:ControlParameter ControlID="ToTextBox" DefaultValue="1/1/2200" 
                        Name="delivered_date_to" PropertyName="Text" Type="DateTime" />
                </SelectParameters>
            </asp:ObjectDataSource>
        </td>
    </tr>
    </table>
</asp:Content>
